Lazy Strength Reduction
نویسنده
چکیده
We present a bit-vector algorithm that uniformly combines code motion and strength reduction, avoids superruous register pressure due to unnecessary code motion, and is as eecient as standard unidirectional analyses. The point of this algorithm is to combine the concept of lazy code motion of 1] with the concept of unifying code motion and strength reduction of 2, 3, 4]. This results in an algorithm for lazy strength reduction, which consists of a sequence of unidirectional analyses, and is unique in its transformational power. 1 Motivation Code motion improves the runtime eeciency of a program by avoiding unnecessary recom-putations of a value at runtime. Strength reduction improves runtime eeciency by reducing \expensive" recomputations to less expensive ones, e.g., by reducing computations involving multiplication to computations involving only addition. Common to both techniques is replacing the original computations of a program by auxiliary variables (registers) that are initialized at suitable program points. In the case of strength reduction, they are additionally updated at certain points. The similarity between strength reduction and code motion suggests the combination of both techniques, an idea which was rst realized by an algorithm of Joshi and Dhamdhere 2, 3] that enhances the code motion algorithm of Morel and Renvoise 5] to capture strength reduction. In this paper we combine Joshi and Dhamdhere's approach with the idea of lazy code motion presented in 1]. This results in an algorithm for lazy strength reduction, which uniformly combines code motion and strength reduction, and avoids any unnecessary register pressure. In fact, in contrast to previous algorithms, it does not insert multiplications and additions on the same path, minimizes the lifetimes of moved computations, and limits the insertion of multiple additions on a path to a minimum. Moreover, as our algorithm is composed of a sequence of unidirectional bit-vector analyses, it is as eecient as the standard unidirectional analyses (cf. The illustration of the essential new features of our algorithm requires a rather complex program structure. In the example of Figure 1, which is a slight modiication of an example of 3], our lazy strength reduction algorithm is unique in yielding the result shown in Figure 2.
منابع مشابه
A Chemical Abstract Machine for Graph Reduction
Graph reduction is an implementation technique for the lazy λ-calculus. It has been used to implement many non-strict functional languages, such as lazy ML, Gofer and Miranda. Parallel graph reduction allows for concurrent evaluation. In this paper, we present parallel graph reduction as a Chemical Abstract Machine, and show that the resulting testing semantics is adequate wrt testing equivalen...
متن کاملHardware-Assisted and Target-Directed Evaluation of Functional Programs
A new reduction machine for lazy functional languages called the Reduceron is proposed. The Reduceron exploits wide, parallel memories to increase evaluation speed, and is prototyped in programmable hardware. It is compared with conventional machines by a theoretical analysis and by an experimental comparison. It is shown that the use of wide, parallel memories in a graph reduction machine can ...
متن کاملA High Speed Pairing Coprocessor Using RNS and Lazy Reduction
In this paper, we present a high speed pairing coprocessor using Residue Number System (RNS) and lazy reduction. We show that combining RNS, which are naturally suitable for parallel architectures, and lazy reduction, which performs one reduction for more than one multiplication, the computational complexity of pairings can be largely reduced. The design is prototyped on a Xilinx Virtex-6 FPGA,...
متن کاملLazy Strong Normalization
Among all the reduction strategies for the untyped λ-calculus, the so called lazy β-evaluation is of particular interest due to its large applicability to functional programming languages (e.g. Haskell [3]). This strategy reduces only redexes not inside a lambda abstraction. The lazy strongly βnormalizing terms are the λ-terms that don’t have infinite lazy β-reduction sequences. This paper pres...
متن کاملThe Implementation of Lazy Narrowing
Lazy narrowing has been proposed as the operational model of functional logic languages. This paper presents a new abstract machine which implements lazy narrowing. The core of this machine consists of a conventional stack based architecture like the one used for imperative languages. Almost orthogonal extensions of this core implement the diierent concepts of functional logic languages. This s...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1993